﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using General.Core.Data;
using General.Entities;
using General.Entities.Models;
using General.Entities.Students;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;

// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace General.Mvc.Controllers
{
    public class TestController : Controller
    {
        private readonly GeneralDbContext dbcontext;
        private readonly IRepository<Students> studentsRepository;


        public TestController(GeneralDbContext dbcontext, IRepository<Students> studentsRepository)
        {
            this.dbcontext = dbcontext;
            this.studentsRepository = studentsRepository;
        }




        // GET: /<controller>/
        [HttpGet]
        public IActionResult Index()
        {
            string conn = this.dbcontext.Database.GetDbConnection().ConnectionString;
            //return Ok(conn);
            return BadRequest("no auth");
        }



        [HttpGet]
        public IActionResult Get2()
        {
            var model = studentsRepository.GetAllAsync();

            return Ok(model);
        }



    }
}
